package com.ls.fw.mvc.springmvc.support.listener;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;

import org.springframework.web.context.WebApplicationContext;

public class WebContextListener extends org.springframework.web.context.ContextLoaderListener {
	
	@Override
	public WebApplicationContext initWebApplicationContext(ServletContext servletContext) {
		StringBuilder sb = new StringBuilder();
		sb.append("\r\n======================================================================\r\n");
		sb.append("\r\n    欢迎使用 backend-mvc-springmvc - Powered By lisheng\r\n");
		sb.append("\r\n======================================================================\r\n");
		System.out.println(sb.toString());
//		try {
//			Map<String, Object> ketMap = RSACoder.initKey();
//			String priKey = RSACoder.getPrivateKey(ketMap);
//			String pubKey = RSACoder.getPublicKey(ketMap);
//
//			// System.out.println(this.context.getInitParameter("publicKey"));
//			System.out.println(pubKey);
//			servletContext.setInitParameter("publicKey", "ssssssssssss"
//					+ pubKey);
//			System.out.println(servletContext.getInitParameter("publicKey"));
//			// System.out.println(this.context.getInitParameter("privateKey"));
//			// System.out.println(prikeys);
//		} catch (Exception e) {
//			e.printStackTrace();
//		}
		return super.initWebApplicationContext(servletContext);
	}

	@Override
	public void contextInitialized(ServletContextEvent event) {
		super.contextInitialized(event);
	}

	@Override
	public void contextDestroyed(ServletContextEvent event) {
		super.contextDestroyed(event);
	}
}
